Skip to content

Switch --permission to accept >=1 parameters#966

Merged
inclement merged 1 commit intokivy:masterfrom
KeyWeeUsr:multi_permissions
Jan 12, 2017
Merged

Switch --permission to accept >=1 parameters#966
inclement merged 1 commit intokivy:masterfrom
KeyWeeUsr:multi_permissions

Conversation

@KeyWeeUsr
Copy link
Contributor

Usage results:

  • single value

    ['param']
    
  • two or more values

    ['param1', 'param2']
    
  • two or more --permission args with at least one value each

    [['param1', 'param2'], ['param3', 'param4']]
    

which is later flattened.

Closes #673

When used with a single value -> ['param'], two or more values -> ['param1', 'param2'], two or more --permission args -> [['param1', 'param2'], ['param3', 'param4']] which is later flattened. Closes kivy#673
args.permissions = []
elif args.permissions:
if isinstance(args.permissions[0], list):
args.permissions = [p for perm in args.permissions for p in perm]
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Using p as the variable name twice makes me twitchy ;)

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think I don't understand. It's a list comprehension, it wants the returning variable like that, otherwise it'd be this:

_new_permissions = []
for permission in args.permissions:
    for perm in permission:
        _new_permissions.append(perm)
args.permissions = _new_permissions

and repeated three times (pygame+sdl2+webview).

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oh okay, I just misread it.

@inclement inclement merged commit f6433d0 into kivy:master Jan 12, 2017
@inclement
Copy link
Member

Thanks :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants